﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Temp.Controller;
using Temp.Model;
using Temp.NLG;
using Temp.View;

namespace Temp.Planner2
{
    class ItemPlanner
    {
        private ItemController ic;
        private Describer idesc;
        private DialogueView dv;
        private StoryNode currentNode;
        private List<Item> listInventory;
        private StoryPlanner sp;

        /// <summary>
        /// Constructor for ItemPlanner
        /// </summary>
        /// <param name="dv">Instance of DialogueView class</param>
        /// <param name="storyPlanner">Instance of StoryPlanner clas</param>
        /// <param name="listInventory">List of items in the inventory</param>
        public ItemPlanner(DialogueView dv, StoryPlanner storyPlanner, List<Item> listInventory)
        {
            ic = new ItemController();
            this.dv = dv;
            this.listInventory = listInventory;
            this.sp = storyPlanner;
            idesc = new Describer(storyPlanner);
        }

        /// <summary>
        /// Calls the dialogue view class to render the description of the item
        /// </summary>
        /// <param name="itemName">Name of the item. This is used for reference  to retrieve the description of the item</param>
        public void renderItemDescription(string itemName)
        {
            if (listInventory.Count < sp.MAX_CAPACITY_INVENTORY)
            {
                dv.listDialogue = idesc.getItemDescription(itemName, idesc.ITEMTYPE);
            }
            else {
                Conversation c = new Conversation("Alex", "I'm sorry but it looks like we can't carry more items.", 'P');
                List<Conversation> clist = new List<Conversation>();
                clist.Add(c);
                dv.listDialogue = clist;
            }
            dv.modifyListDialogue();
            dv.char2Pic = null;
            dv.isShowing = true;

        }

    }
}
